package test
{
	import flash.utils.describeType;

	import org.abio.XasML.reflect.ClassInfo;
	import org.abio.XasML.reflect.MetadataInfo;
	import org.abio.XasML.reflect.ParameterInfo;
	
	public class xml
	{
		public function xml()
		{
		}
		
		public function testMapper():void{
			var c1:xml_class_1=new xml_class_1();
			var c2:xml_class_2=new xml_class_2(123);
			
//			trace(flash.utils.describeType(xml_class_2));
			trace(ClassInfo.of(xml_class_2).isType(xml_class_2));
			trace(ClassInfo.of(xml_class_2).isType(xml_class_1));
			trace(ClassInfo.of(xml_class_2).isType(xml_interface_2));
			trace(ClassInfo.of(xml_class_2).isType(xml_interface_1));
			trace(ClassInfo.of(xml_class_1).isType(xml_class_2));
			trace(ClassInfo.of(xml_class_1).isType(xml_class_1));
			trace(ClassInfo.of(xml_class_1).isType(xml_interface_2));
			trace(ClassInfo.of(xml_class_1).isType(xml_interface_1));
			trace(ClassInfo.of(xml_class_1).isType(xml));
			trace('--------------------------------------------------------');
			trace(ClassInfo.of(xml_class_1).constructor.parameters);
			trace(ClassInfo.of(xml_class_1).constructor.invoke());
			trace(ClassInfo.of(xml_class_2).constructor.parameters);
			trace(ClassInfo.of(xml_class_2).constructor.invoke(123));
			trace((ClassInfo.of(xml_class_2).constructor.parameters[0] as ParameterInfo).Type);
			trace((ClassInfo.of(xml_class_2).constructor.parameters[0] as ParameterInfo).Optional);
			trace('--------------------------------------------------------');
			trace(ClassInfo.of(xml_class_2).staticMethods);
			trace(ClassInfo.of(xml_class_2).staticProperties);
			trace(ClassInfo.of(xml_class_2).methods);
			trace(ClassInfo.of(xml_class_2).properties);
			trace(ClassInfo.of(xml_class_2).getStaticMethod('c2_f1').invoke(xml_class_2, '001'));
			trace(ClassInfo.of(xml_class_2).getMethod('c1_f1').invoke(c2, 22, 33));
			trace(ClassInfo.of(xml_class_2).getMethod('c1_f1').parameters);
			trace(ClassInfo.of(xml_class_2).getMethod('c1_f1').Name);
			trace(ClassInfo.of(xml_class_2).getMethod('c1_f1').ReturnType);
			trace('--------------------------------------------------------');
			trace(ClassInfo.of(xml_class_1).getStaticProperty('c1_s_v1').getValue(null));
			trace(ClassInfo.of(xml_class_2).getProperty('c1_v1').setValue(c2, 12345));
			trace(ClassInfo.of(xml_class_2).getProperty('c1_v1').getValue(c2));
			trace(ClassInfo.of(xml_class_2).getStaticProperty('c2_s_v1').getValue(null));
			trace(ClassInfo.of(xml_class_2).getProperty('c2_v1').setValue(c2, 'asdfg'));
			trace(ClassInfo.of(xml_class_2).getProperty('c2_v1').getValue(c2));
			trace('--------------------------------------------------------');
			MetadataInfo.register(xml_metadata_1);
			MetadataInfo.register(xml_metadata_2);
			trace(ClassInfo.of(xml_class_2).getMethod('c1_f1').metadatas);
			trace(ClassInfo.of(xml_class_2).getProperty('c2_v1').metadatas);
			trace(ClassInfo.of(xml_class_2).getMetadata('xml_metadata_1'));
			trace((ClassInfo.of(xml_class_2).getMetadata('xml_metadata_1') as xml_metadata_1).info);
		}
	}
}
